<?
	require_once('init.php');
	require_once('dataModel.php');
	require_once('cartClass.php');
 
 	if(!isset($_SESSION['cart'])) 
 	{ 
		$_SESSION['cart'] =serialize(new Cart()); 
	}
  
  	$cartItem=unserialize($_SESSION['cart']);
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head> 
	<meta http-equiv="Content-Type" content="text/html; charset=<?=$lng_characset;?>" />
	<meta name="keywords" content="GreenCity,Shoes,Ь,��Ь,ŮЬ,����" />
	<meta name="description" content="GreenCity" />
	<meta name="copyright" content="Copyright (c) 2011 www.GreenCity.com All Rights Reserved." />
	<meta name="publisher" content="Copyright (c) 2010 www.GreenCity.com All Rights Reserved." />
	<meta name="author" content="GreenCity Team" />
	
	<TITLE><?=$AllPageTitle;?></TITLE> 

	<link href="css/main.css" rel="stylesheet" type="text/css" />
	<link href="css/Buttonstyle.css" rel="stylesheet" type="text/css" />
	<link href="css/jquery.hiAlerts.css" rel="stylesheet" type="text/css" />
	<link href="css/body2.css" rel="stylesheet" type="text/css" />

	<? include("alljs.php"); ?>

	<script type="text/javascript" src="Scripts/jquery.js"></script>
	<script type="text/javascript" src="Scripts/jquery.jqzoom.js"></script>	

	<script language="javascript">
   		function removecart(GID,CID,SID,NUM)
   		{
		   	var strSQL = "";                      
		   	strSQL+="iType=2";
		   	strSQL+="&GID="+GID;
		   	strSQL+="&CID="+CID;
		   	strSQL+="&SID="+SID;
		   	strSQL+="&NUM="+NUM;

			parent.hiConfirm('<?=$strdelcartyesno;?>', '<?=$strclueinfo;?>', function(r) 
			{       
				if (r) 
				{
					$.post("goodsCart.php",strSQL,function(msg)
					{
					   	if (msg=='1')
					   	{	
							parent.hiAlert("<?=$strdelcart;?>", '<?=$strclueinfo;?>');
							setTimeout('location.reload();parent.$("#popup_ok").click();',3000); //�����ر���ʾ��������ס��
							return false;
					   	}
					})
				}	
			})	
		}
					
   		function continueshop()
   		{
			location="body2.php";
		}  

   		function addorder()
   		{
			location="goodsorder.php";
		}   
	</script>

</head>
	<body>	
		<?
		include("header.php"); 
		?>

		<div id="body2_all" >
			<div id="body2_h01" ></div>
			
			<div class="cartdetail_div">
				<div class="cartdetail_a01"><b><?=$strmycart;?></b></div>	

				<div class="cartdetail_a02">
					<div class="cartdetail_a04">

						<div class="cartdetail_a09" style="height:27px;line-height:27px;">
							<div class="cartdetail_a10" style="height:27px;line-height:27px;color:#629EB0"><b><?=$strProduct;?></b></div>
							<div class="cartdetail_a11" style="height:27px;line-height:27px;color:#629EB0"><b></b></div>
							<div class="cartdetail_a12" style="height:27px;line-height:27px;color:#629EB0"><b><?=$strSizeWidth;?></b></div>
							<div class="cartdetail_a13" style="height:27px;line-height:27px;color:#629EB0"><b><?=$stradviceprice;?></b></div>
							<div class="cartdetail_a14" style="height:27px;line-height:27px;color:#629EB0"><b><?=$strnum;?></b></div>
							<div class="cartdetail_a15" style="height:27px;line-height:27px;color:#629EB0"><b><?=$strSubTotal;?></b></div>
							<div class="cartdetail_a16" style="height:27px;line-height:27px;color:#629EB0"><b><?=$strRemove;?></b></div>
				    	</div>


						<?
						$Items=$cartItem->getCart();
						$dblAmt=0;  
						$dblNum=0;  
						foreach($Items as $iItem)
						{
							$iKeyIDs=$iItem['ID']; 
							$iKeyID= explode("^",$iKeyIDs);
							$iGID=$iKeyID[0];
							$iCID=$iKeyID[1];
							$iSID=$iKeyID[2];
							$iCount=$iItem['count'];
                            
                            $strSQL ="";

							$strSQL = "select g.id,g.goodsid,g.pic1,g.adviceprice,g.".$strLanguage_Goods.",c.".$strLanguage_Color.",s1.".$strLanguage_Sort1.",s2.".$strLanguage_Sort2." ";
							$strSQL.= "from goods g left join color c on c.id=g.colorid ";
							$strSQL.= "             left join sort1 s1 on s1.id=g.sort1id ";
							$strSQL.= "             left join sort2 s2 on s2.id=g.sort2id ";
							$strSQL.= "where g.id='".$iGID."' limit 0,1";
							
							$db = MySQL::getInstance('','r-w'); 
							$rsGoods = $db->fetch($db->query($strSQL));
							
							$iGoodsID=$rsGoods["goodsid"];
							$iColor=$rsGoods["colorname"];
							$iPic=$rsGoods["pic1"];
							$iAdvicePrice=$rsGoods["adviceprice"];
							$iAmt=$iAdvicePrice*$iCount;
							
							$dblAmt=$dblAmt+$iAmt; 
							$dblNum=$dblNum+$iCount;  
						?>
							<div class="cartdetail_a09" style="height:100px;line-height:27px;">

								<div class="cartdetail_a10">
									<img src="<?=$lng_picpath;?><?=$rsGoods["pic1"];?>" width="130" height="80" border="0" style="margin-top:5px; margin-left:5px;" />
								</div>
								<div class="cartdetail_a11">
									<div class="cartdetail_a20" style="margin-top:15px;"><?=$iColor;?></div>
									<div class="cartdetail_a20"><?=mb_strimwidth($rsGoods["goodsname"],0,16,'...');?></div>
									<div class="cartdetail_a20"><?=$rsGoods["sort1name"];?></div>
									<!--div class="cartdetail_a20"><?=$rsGoods["sort2name"];?></div-->
								</div>
								<div class="cartdetail_a12"><?=$iSID;?></div>
								<div class="cartdetail_a13">$ <?=$iAdvicePrice;?>.00</div>
								<div class="cartdetail_a14"><?=$iCount;?></div>
								<div class="cartdetail_a15">$ <?=$iAmt;?>.00</div>
								<div class="cartdetail_a16" style="padding-top:32px;">
									<input type="image" name="remove" value="remove" src="images/<?=$lang['strremove']?>" onclick="javascript:removecart('<?=$iGID;?>','<?=$iCID;?>','<?=$iSID;?>','<?=$iCount;?>');" >
								</div>
					    	</div>
					    	
						<?	
						} 
						?>

						<div class="cartdetail_a17">
							<div class="cartdetail_a18"><?=$strSubTotal.": ";?></div>
							<div class="cartdetail_a19"><?="$ ".$dblAmt.".00";?></div>
							<div class="cartdetail_a18"><?=$strSalesTax.": ";?></div>
							<div class="cartdetail_a19">$ 0.00</div>
							<div class="cartdetail_a18"><?=$strStdShipping.": ";?></div>
							<div class="cartdetail_a19">$ 0.00</div>
						</div>						

						<div class="cartdetail_a17" style="height:30px;">
							<div class="cartdetail_a18" style="font-size:16px;"><b><?=$strCURRENTTOTAL;?></b></div>
							<div class="cartdetail_a19" style="font-size:16px;"><b><?="$ ".$dblAmt.".00";?></b></div>
						</div>						

						<div class="cartdetail_a03">
							<input type="image" name="addorder" value="addorder" src="images/<?=$lang['straddcartorder']?>" onclick="javascript:addorder();" >
							<input type="image" name="continueshop" value="continueshop" src="images/<?=$lang['strcontinueshop']?>" onclick="javascript:continueshop();" >
						</div>	
					</div>

					<div class="cartdetail_a05">
						<div class="cartdetail_a06"><?=$strcarthelp01;?></div>
						<div class="cartdetail_a07" style="margin-top:10px;"><b><?=$strcarthelp01;?></b></div>
						<div class="cartdetail_a07"><?=$strcarthelp03;?></div>

						<div class="cartdetail_a07" style="margin-top:15px;"><b><?=$strcarthelp04;?></b></div>
						<div class="cartdetail_a07"><?=$strcarthelp05;?></div>

						<div class="cartdetail_a07" style="margin-top:15px;"><b><?=$strcarthelp06;?></b></div>
						<div class="cartdetail_a07"><?=$strcarthelp07;?></div>

						<div class="cartdetail_a08" style="height:2px;margin-top:20px;border-top:1px solid #629EB0;"></div>
						<div class="cartdetail_a06"><?=$strcarthelp08;?></div>
						<div class="cartdetail_a07" style="color:#629EB0;font-size:12px;"><b><?=$strcarthelp09;?></b></div>
						<div class="cartdetail_a07" style="color:#629EB0;font-size:12px;"><b><?=$strcarthelp10;?></b></div>
						
					</div>
				</div>	
			</div>	

			<div id="body2_h02" ></div>
		</div>


		<?
		include("footer.php"); 
		?>
	</body>		
</html>